package com.volkanic.controller;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;

/**
 * Created by Lucas on 27/07/2014.
 */
public class BackController implements InputProcessor{

    /**
     * Tag for debugging
     */
    private final String TAG = "BackController";
    /**
     * GameController of the game
     */
    private GameController _gameController;

    /**
     * Initialize a new instance of the class BackController
     * @param controller The controller of the game
     */
    public BackController(GameController controller){
        _gameController = controller;
        Gdx.input.setCatchBackKey(true);
    }

    @Override
    public boolean keyDown(int keycode) {
        if (keycode == Input.Keys.BACK) {
            Gdx.app.debug(TAG, "Back Key pressed");
            _gameController.previousScreen();
            return true;
        }
        return false;
    }

    @Override
    public boolean keyUp(int keycode) {
        Gdx.app.debug(TAG, "KeyUp, NotImplemented");
        return false;
    }

    @Override
    public boolean keyTyped(char character) {
        Gdx.app.debug(TAG, "KeyTyped, NotImplemented");
        return false;
    }

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        Gdx.app.debug(TAG, "touchDown, NotImplemented");
        return false;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        Gdx.app.debug(TAG, "touchUp, NotImplemented");
        return false;
    }

    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        Gdx.app.debug(TAG, "touchDragged, NotImplemented");
        return false;
    }

    @Override
    public boolean mouseMoved(int screenX, int screenY) {
        Gdx.app.debug(TAG, "mouseMoved, NotImplemented");
        return false;
    }

    @Override
    public boolean scrolled(int amount) {
        Gdx.app.debug(TAG, "scrolled, NotImplemented");
        return false;
    }
}
